package com.shop.config;


import com.shop.inteceptorMember.AuthorityInterceptor;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author wzby
 * @Date: 2022/10/16 10:50
 */
@Configuration
public class WebConfig implements WebMvcConfigurer {

    @Value("${beiyou.token.secret}")
    private  String  TOKEN_SECRET;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
       registry.addInterceptor(new AuthorityInterceptor(TOKEN_SECRET))
               .addPathPatterns("/member-api/**")
               .excludePathPatterns("/member-api/member/login");
    }
}
